<div id="left_side">
	<!--Header-->
	<div id="music_play_header">
		<!--Playlist-->
		<a href="<?php echo $playlist_url.'music/'.$dataResult->song_id.'-'.seo_url($dataResult->song_name);?>" target="_blank" class="_playlist" title="add to playlist"></a>
		<h1>
			เพลง <?php echo $dataResult->song_name;?>
		</h1>
		<h2>
			<?php foreach($dataResult->artist as  $value):?>
			<?php echo $value['artist_name'].' ';?>
			<?php endforeach;?>
		</h2>
		<a href="<?php echo $playlist_url.'music/'.$dataResult->song_id.'-'.seo_url($dataResult->song_name);?>" target="_blank" class="_playlist _text"title="add to playlist"></a>
	</div>
	<!--Music Play Content-->
	<div id="music_play_order2">
	<div id="music_play_content">
		<!--Song Lyrics-->
<!--		<div id="music_play_lyrics">
			<h2>เนื้อเพลง <?php //echo $dataResult->song_name;?></h2>
			<p>
				<?php //if(!empty($dataResult->song_lyrics)):?>
					<?php //echo $dataResult->song_lyrics;?>
				<?php //else:?>
					ไม่พบ เนื้อเพลง ของ <?php //echo $dataResult->song_name;?>
				<?php //endif;?>
			</p>
		</div>-->	
		<!--Song Description-->
		<div id="music_play_description">
			<div class="leftSide">
				<div class="image">
					<?php echo exec_image(array(
							'folder' => 'album',
							'dimension' => '160x160',
							'file_name' => @$dataResult->album->album_file_name.'.'.@$dataResult->album->album_file_ext,
							'alt' => ''.@$dataResult->album->album_name.'',	
							'title' => ''.@$dataResult->album->album_name.''	
						)
					);?>
				</div>
				<div class="vote">
					<a href="javascript:void(0);" onclick="javascript:voteSong(this,<?php echo $dataResult->song_id;?>,1);" class="star <?php echo (floor($dataResult->rate_score) >= 1 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteSong(this,<?php echo $dataResult->song_id;?>,2);" class="star <?php echo (floor($dataResult->rate_score) >= 2 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteSong(this,<?php echo $dataResult->song_id;?>,3);" class="star <?php echo (floor($dataResult->rate_score) >= 3 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteSong(this,<?php echo $dataResult->song_id;?>,4);" class="star <?php echo (floor($dataResult->rate_score) >= 4 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteSong(this,<?php echo $dataResult->song_id;?>,5);" class="star <?php echo (floor($dataResult->rate_score) >= 5 ? 'active':'');?>"></a>	
					<div>ผลโหวต <span class="voteAvg"><?php echo $dataResult->rate_score;?></span> จาก <span class="votePeople"><?php echo number_format($dataResult->song_rate_all);?></span> คน</div>					
				</div>
				<!--Valid Review Song-->
				<?php if(isset($dataSongReview) && !empty($dataSongReview)):?>
					<a href="<?php echo $news_url.'archives/'.$dataSongReview->news_id.'-'.seo_url($dataSongReview->news_subject);?>" class="reviewSong" target="_blank">รีวิวเพลงนี้</a>
				<?php endif;?>
			</div>
			<div class="rightSide">
				<h2>เพลง <?php echo $dataResult->song_name;?></h2>
				<?php if(!empty($dataResult->artist)):?>
				<h4>
					ศิลปิน : 
					<?php foreach($dataResult->artist as $value):?>
						 <a href="<?php echo $artist_url.'summary/'.$value['artist_id'].'-'.seo_url($value['artist_name']);?>" target="_blank"><?php echo $value['artist_name'];?></a>&nbsp;
					<?php endforeach;?>
				</h4>
				<?php endif;?>
				<?php if(!empty($dataResult->artist) && !empty($dataResult->album)):?>				
				<h4>
					อัลบั้ม :
					<a href="<?php echo $artist_url.'album/'.$dataResult->artist[0]['artist_id'].'-'.seo_url($dataResult->artist[0]['artist_name']).'/'.$dataResult->album->album_id.'-'.seo_url($dataResult->album->album_name);?>" target="_blank"><?php echo $dataResult->album->album_name;?></a>&nbsp;
				</h4>
				<?php endif;?>
				<?php if(!empty($dataResult->genre_tag)):?>
				<h4>ประเภท : <?php echo $dataResult->genre_tag;?></h4>
				<?php endif;?>
				<p>
					<?php echo $dataResult->song_description;?>
				</p>
			</div>
			<div class="clear"></div>
			<hr />
			<h2>เนื้อเพลง <?php echo $dataResult->song_name;?></h2>
			<p id="lyric">
				<?php if(!empty($dataResult->song_lyrics)):?>
					<?php echo $dataResult->song_lyrics;?>
				<?php else:?>
					ไม่พบ เนื้อเพลง ของ <?php echo $dataResult->song_name;?>
				<?php endif;?>
			</p>
		</div>
		<!--Song Chords-->
		<div id="music_play_chords">
			<h2>คอร์ดเพลง <?php echo $dataResult->song_name;?></h2>
			<p>
				<?php if(!empty($dataResult->song_chords)):?>
					<?php echo $dataResult->song_chords;?>
				<?php else:?>
					ไม่พบ คอร์ดเพลง ของ <?php echo $dataResult->song_name;?>
				<?php endif;?>
			</p>
		</div>		
		<!--Song Share-->
		<div id="music_play_share">
			<input type="text" value="<?php echo $music_url.'play/'.$dataResult->song_id;?>" id="page_url" name="page_url" readonly="true">
			<a href="javascript:void(0);" id="copy_page_url" onmouseOver="toClipboard(this)"><?php echo image_asset('music/copy_url.jpg','',array('width' => 73,'height' => 19));?></a><br />
			<?php if(empty($dataResult->song_embed)):?>
				<input type="text" value="&lt;iframe width=&quot;640&quot; height=&quot;382&quot; src=&quot;//www.you2play.com/player/music/<?php echo $dataResult->song_id;?>&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allowtransparency=&quot;true&quot;&gt;&lt;/iframe&gt;" id="page_embed" name="page_embed" readonly="true">
				<!--<input type="text" value="&lt;embed src=&quot;http://embed.you2play.com/you2play/flash/song_player3.swf&quot; width=&quot;400&quot; height=&quot;170&quot; FlashVars=&quot;_SID=<?php echo $dataResult->song_id;?>&amp;autostart=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; movie=&quot;http://embed.you2play.com/you2play/flash/song_player3.swf&quot;&gt;&lt;/embed&gt;" id="page_embed" name="page_embed" readonly="true">-->
				<a href="javascript:void(0);" id="copy_page_embed" onmouseOver="toClipboard(this)"><?php echo image_asset('music/copy_embed.jpg','',array('width' => 73,'height' => 19));?></a><br />
			<?php endif;?>
		</div>				
	</div>
	<!--Comment-->
	<div id="music_play_comment">
		<h2>
			<span>แสดงความคิดเห็น</span>
		</h2>
		<!--Facebook Comment-->
		<?php echo $module_facebook_plugins_comment;?>
	</div>
	</div>	
	<div id="music_play_order1">
	<!--Music Player-->
	<div id="music_play_bg">
		<script type='text/javascript'>
		<!--// <![CDATA[
		var OA_zones = {
			'ads_top' : 131,
			'ads_bottom' : 128
		}
		// ]]> -->
		</script>
		<script type='text/javascript' src='http://ads.you2play.com/openx/delivery/spcjs.php'></script>		
		<div id="music_play_ads_top">
			<script type='text/javascript'>
			<!--// <![CDATA[
				OA_show('ads_top');
			// ]]> -->
			</script>			
		</div>
		<div id="music_play_object">
			<?php if(!empty($dataResult->song_embed)):?>
				<?php echo $dataResult->song_embed;?>
			<?php else:?>
				<!--Vdo Player-->
				<div id="vdoPlayer">
					<?php if($this->agent->is_mobile()):?>
						<video id='my_video' controls preload='none'></video>
					<?php endif;?>
				</div>
			<?php endif;?>
		</div>
		<div id="music_play_ads_bottom">
			<script type='text/javascript'>
			<!--// <![CDATA[
				OA_show('ads_bottom');
			// ]]> -->
			</script>				
		</div>
	</div>
	<!--Music Relate-->
	<div id="music_play_relate">
		<?php if(!empty($dataSongRelate)):?>
		<div class="cycleElementsContainer" id="slider">
			<a href="#" id="cycle-prev"></a>
			<div>
			<ul>
				<?php foreach($dataSongRelate as $key => $value):?>
				<li>
					<a href="<?php echo base_url().'play/'.end(explode('_',$value->id)).'-'.seo_url($value->song_name_s);?>" target="_self">
						<div class="image">
							<?php echo exec_image(array(
									'folder' => 'album',
									'dimension' => '60x60',
									'file_name' => @$value->album->album_image_name_s,
									'alt' => ''.@$value->album->album_name_s.'',	
									'title' => ''.@$value->album->album_name_s.''	
								)
							);?>
						</div>	
					</a>
					<div class="info">
						<!--Playlist-->
						<a href="<?php echo $playlist_url.'music/'.end(explode('_',$value->id)).'-'.seo_url($value->song_name_s);?>" target="_blank" class="_playlist" title="add to playlist"></a>
						<a href="<?php echo base_url().'play/'.end(explode('_',$value->id)).'-'.seo_url($value->song_name_s);?>" target="_self"><h3><?php echo $value->song_name_s;?></h3></a>
						<p>
							<?php if(!empty($value->artist)) foreach($value->artist as $artist):?>
								<?php echo $artist->artist_name_s;?>
							<?php endforeach;?>
						</p>
					</div>			
				</li>
				<?php endforeach;?>
			</ul>
			</div>
			<a href="#" id="cycle-next"></a>
		</div>
		<?php endif;?>
		<div id="music_play_menu">
			<ul>
				<li>
					<a href="javascript:void(0);" class="active" onclick="javascript:goTab('#music_play_description',this);">รายละเอียด</a>
				</li>
<!--				<li>
					<a href="javascript:void(0);" onclick="javascript:goTab('#music_play_lyrics',this);">เนื้อเพลง</a>
				</li>-->
				<li>
					<a href="javascript:void(0);" onclick="javascript:goTab('#music_play_share',this);">แชร์</a>
				</li>
				<?php if(!empty($dataResult->chords_id)):?>
				<li>
					<a href="<?php echo $chord_url.'play/'.$dataResult->chords_id.'-'.seo_url($dataResult->song_name);?>" target="_blank">คอร์ด/แทป</a>
				</li>
				<?php endif;?>			
			</ul>
			<span>
				ฟัง <?php echo number_format($dataResult->views);?> ครั้ง
			</span>
		</div>
	</div>
	<!--Facebook Plugin-->
	<?php echo $module_facebook_plugins_share;?>
	</div>
</div>
<div id="right_side">
	<!--Module-->
	<?php
	if(!empty($module))
	foreach($module as $value):?>
	<?php echo $value;?>
	<?php endforeach;?>
</div>
<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		//multipleElementsCycle
		$("#slider").multipleElementsCycle({
			scrollCount: 3,
			start: 0
		});
		
		//Countdown to keep stats 10 seconds
		setTimeout(function(){
			$.ajax({
				type:'post',
				url: web_path+'ajax_view_song',
				data:({
					id:'<?php echo $dataResult->song_id;?>'	
				})
			});
		},10000);			
	});	
})(jQuery);
	/*ZeroClipboard*/
	function toClipboard(e)
	{
		ZeroClipboard.setMoviePath("<?php echo base_url().'ZeroClipboard.swf';?>");
		var clip = new ZeroClipboard.Client();
	    clip.setHandCursor( true );		
		var id_copy = '#'+$(e).attr('id').replace('copy_','');	
		var id = $(e).attr('id');	
		copything = $(''+id_copy+'').val();
		clip.setText(copything);
		if (clip.div)
		{
			clip.receiveEvent('mouseout', null);
			clip.reposition(id);
		}
		else
		{
			clip.glue(id);
		}

		clip.receiveEvent('mouseover', null);
		//When User Copy Link
		clip.addEventListener('complete', function (client, text) {
			$.ajax({
				type:'post',
				url:web_path+'ajax_copy_stat',
				data:({
					song_id:'<?php echo $dataResult->song_id;?>'
				})	
			}).done(function(data){
				alert('คัดลอกข้องมูลลง Clipboard เรียบร้อย');
			});
		});		
	}
</script>	
<?php if(empty($dataResult->song_embed)): //if no embed load jwplayer?>
<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		var is_mobile = '<?php echo $this->agent->is_mobile();?>';
		//var url = "<?php echo other_asset_url('uploads/song/files/'.date('Y/m/d',strtotime($dataResult->create_date)).'/'.$dataResult->song_file_name.'.'.$dataResult->song_file_ext);?>";
		var url = "http://vstatic.you2play.com/2013/assets/<?php echo 'uploads/song/files/'.date('Y/m/d',strtotime($dataResult->create_date)).'/'.$dataResult->song_file_name.'.'.$dataResult->song_file_ext;?>";
		if(is_mobile){
			//Set Video Source
			$('#my_video').append("<source id='mp3' src='"+url+"' type='audio/mp3'>");
			$('#my_video').attr('src',""+url+"");
			$('#my_video').attr('width',640);
			$('#my_video').attr('height',382);		
			// videoplaza sdk, 4 sec time-out, callback function
			//loadScript("<?php //echo js_asset_url('media/html5-sdk-1.0.12.15.1-ea.min.js');?>",4000,initVideoplaza);
			// *** START - videoplaza plugin config ***
/*			vpConfig = {
				vphost : 'http://th-pmdplus.videoplaza.tv',
				category : 'music',
				tags : ['standard'],
				flags: [],
				playbackPosition: [] // mid-roll cue points, if any.
			}*/
			// *** END - videoplaza plugin config ***
			//Auto Play && Loop
			$('#my_video').attr('autoplay','autoplay');	
		} else {
			var playlist = [{file:""+url+"",image: "<?php echo other_asset_url('uploads/album/images/original/'.@$dataResult->album->album_file_name.'.'.@$dataResult->album->album_file_ext);?>"}];
/*			jwplayer('vdoPlayer').setup({
			  "autostart": true,
			  "flashplayer": "<?php //echo js_asset_url('media/player.swf');?>",
			  "playlist": playlist,
			  "width": 640,
			  "height": 382,
			  "controlbar": {
			    "position": "bottom"
			  },
			  "plugins": {
			    "ova-jw": {
				  "canFireEventAPICalls": true,
			      "ads": {
			        "skipAd": {
			          "enabled": "true"
			        },
			        "schedule": [
			          {
			            "position": "pre-roll",
			            "tag": ""+generatTag('<?php //echo json_encode($dataAds);?>')+""
			          },
					  {
					  	"position": "post-roll",
						"tag": "http://ads.you2play.com/openx/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&source=&format=vast&charset=UTF_8&nz=1&zones=z1=166"
					  } 	  
			        ]
			      }
			    }
			  }
			});*/
/*			jwplayer('vdoPlayer').onComplete(function() {
				var config = { 
				"ads": {
			        "skipAd": {
			          "enabled": "true"
			        },
			        "schedule": [
			          {
			            "position": "pre-roll",
			            "tag": ""+generatTag()+""
			          }	  
			        ]
			      }
				};
				jwplayer('vdoPlayer').getPlugin('ova').scheduleAds(playlist, config);
			});*/
			jwplayer("vdoPlayer").setup({
				"autostart": true,
		      	"flashplayer": "<?php echo js_asset_url('media/player.swf');?>",
				"playlist": playlist,
		      	"width": 640,
		      	"height": 382,
		      	"plugins": "<?php echo js_asset_url('media/vp_plugin.swf');?>",
		      	"vpdomain": "http://th-pmdplus.videoplaza.tv",
		      	"vpshares": "music",
				"closebuttontimeout": 15,
               	"provider": "http",
        		"startparam": "starttime"								
			});	
		}
		
		/*Create Read more Button*/
		var lyric_height_limit = 350;
		var lyric_height = $('#music_play_description').height();
		var is_more_lyric = (lyric_height > lyric_height_limit ? true:false);
		if(is_more_lyric){
			$('#music_play_description').css('height', lyric_height_limit); /*Set Height*/
			/*Add More Button*/
			$('#music_play_content').after('<div id="lyric_toggle"><div>แสดงเพิ่มเติม&nbsp;<span class="arrowUp"><\/span><\/div><\/div>');
						
			/*Add Action Script*/
			$('#lyric_toggle').click(function(){
				if($('#music_play_description').css('height') == lyric_height+'px') {
					$('#music_play_description').css('height', lyric_height_limit);
					$('#lyric_toggle div').html('แสดงเพิ่มเติม&nbsp;<span class="arrowUp"><\/span>');
					$('html, body').animate({scrollTop: $(this).offset().top - lyric_height_limit}, "fast");
				} else {
					$('#music_play_description').css('height', lyric_height);
					$('#lyric_toggle div').html('ซ่อนเนื้อเพลง&nbsp;<span class="arrowDown"><\/span>');	
				}
				event.preventDefault();
			});
		}

	});	
})(jQuery);
</script>
<?php endif;?>